/**
 * @file cfgym/103389/a/main.cpp
 * @brief
 * @see
 * @author Ruiming Guo (guoruiming@stu.scu.edu.cn)
 * @copyright 2022
 * @date 2022/5/15 13:11:29
 **/

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
int n, m, q, i, j, x, y, v, d;
char g[60][60], s[510];
int main() {
  // High rating and good luck!
  cin >> n >> m;
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= m; ++j) {
      cin >> g[i][j];
      if (g[i][j] == '*') {
        x = i, y = j;
        g[i][j] = '.';
      }
    }
  cin >> q;
  scanf("%s", s);
  for (i = 0; i < q; i++) {
    switch (s[i]) {
      case 'L':
        d = (d + 7) % 8;
        break;
      case 'R':
        d = (d + 1) % 8;
        break;
      case 'U':
        v++;
        break;
      case 'D':
        v = max(v - 1, 0);
        break;
    }
    for (j = 0; j < v; j++) {
      if (d == 0)
        if (x - 1 < 1 || g[x - 1][y] == '#')
          break;
        else
          x--;
      else if (d == 2)
        if (y + 1 > m || g[x][y + 1] == '#')
          break;
        else
          y++;
      else if (d == 4)
        if (x + 1 > n || g[x + 1][y] == '#')
          break;
        else
          x++;
      else if (d == 6)
        if (y - 1 < 1 || g[x][y - 1] == '#')
          break;
        else
          y--;
      else if (d == 1)
        if (x - 1 < 1 || y + 1 > m || g[x - 1][y + 1] == '#' ||
            g[x - 1][y] == '#' && g[x][y + 1] == '#')
          break;
        else
          x--, y++;
      else if (d == 3)
        if (x + 1 > n || y + 1 > m || g[x + 1][y + 1] == '#' ||
            g[x + 1][y] == '#' && g[x][y + 1] == '#')
          break;
        else
          x++, y++;
      else if (d == 5)
        if (x + 1 > n || y - 1 < 1 || g[x + 1][y - 1] == '#' ||
            g[x + 1][y] == '#' && g[x][y - 1] == '#')
          break;
        else
          x++, y--;
      else if (d == 7)
        if (x - 1 < 1 || y - 1 < 1 || g[x - 1][y - 1] == '#' ||
            g[x - 1][y] == '#' && g[x][y - 1] == '#')
          break;
        else
          x--, y--;
    }
    if (j < v) v = 0, printf("Crash! ");
    printf("%d %d\n", x, y);
  }
  return 0;
}
